<template>
	<view class="context">
		<u-popup :show="show" mode="center" :round="5" :customStyle="cstyle" :safeAreaInsetBottom="false">
			<view class="title">吃啥隐私政策提示</view>
			<view class="content-box center">
				<scroll-view scroll-y="true" style="width: 80vw; height: 50vh;">
					<view class="rich">
						<rich-text :nodes="shenghe_text"></rich-text>
					</view>
				</scroll-view>
			</view>
			<view class="btn-box space-between">
				<view class="no" @click="signOut">不同意并退出</view>
				<view class="agree" @click="agree">同意</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	// 引入富文本格式化
	import graceRichText from '@/common/richtext.js'

	export default {
		name: "privacy-popup",
		props: {
			show: {
				type: Boolean,
				default: false
			},
			content: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				cstyle: {
					'width': '90vw !important',
				},
			};
		},
		computed: {
			shenghe_text() {
				return graceRichText.format(this.content)
			}
		},
		methods: {
			// 不同意
			signOut() {
				// #ifdef MP-WEIXIN
				//在需要退出小程序的地方调用添加下面代码即可(js文件中)
				wx.exitMiniProgram({
					success: (res) => {}
				})
				// #endif
			},
			// 同意
			agree() {
				this.$emit('agree', false)
				// this.show = false
			}
		}
	}
</script>

<style lang="scss" scoped>
	.context {
		overflow: hidden;
		position: fixed;
	}

	.title {
		font-size: 35rpx;
		font-weight: bold;
		text-align: center;
		padding: 20rpx 0;
		border-bottom: 2rpx solid #c7c7c7;
	}

	.content-box {

		.rich {
			padding: 20rpx;
		}
	}

	.btn-box {
		margin-top: 80rpx;
		padding: 25rpx;

		.no {
			border-bottom: 2rpx solid #0b0b0b;
		}

		.agree {
			background-color: #FFCA39;
			padding: 15rpx 70rpx;
			border-radius: 40rpx;
		}
	}
</style>
